package com.tensquare.qa.config;

import com.tensquare.qa.interceptor.JwtInterceptor;
import javax.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器配置类.
 *
 * @author 宫新程
 * @since 2019/3/16 13:36
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

  @Resource private JwtInterceptor jwtInterceptor;

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    registry
        .addInterceptor(jwtInterceptor)
        .addPathPatterns("/**")
        .excludePathPatterns("/**/login");
  }
}
